package com.pucong.gitee.database.backup.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class UUID {

    public static String uuid(){
        String result = "";
        synchronized (result) {
            result = java.util.UUID.randomUUID().toString();
        }
        return result.replaceAll("-", "");
    }

    /**
     * 获取根据当前时间生成的一个序号,例如：20170921154243425
     * @return
     */
    public static String getSerializNo() {
        Date nowDate = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String nowString = format.format(nowDate);
        return nowString;
    }
}
